<?php
require_once 'conn.php';
//$sid = $_POST['id'];
$id = $_POST['id'];
$id = intval($id);

$username = $_POST['username'];
$sex = $_POST['sex'];
$message = $_POST['message'];
$imgurl = $_POST['imgurl'];
$time_at = time();

$sql = "
UPDATE `bbs`.`t_message`
SET 
`username` = '$username',
`sex` = '$sex',
`content` = '$message',
`avater` = '$imgurl',
`time_at` = '$time_at'
WHERE `t_message`.`id` = $id;
";
//echo "<pre>";
//print_r($rows);
//die;
$result = $conn->query($sql);

if($result>0){
    header("location:index2.php");
}